<?php

mysql_connect('192.168.11.10', 'root', 'Gl-1114');
mysql_select_db('crystal_monitoring');

echo  $_POST['mac'];

if (isset($_POST['mac'])) {
    
    if (!empty($_FILES['my_file'])) {
        
        if ($_FILES['my_file']['error'] > 0) {
            
            echo "Error: " . $_FILES["my_file"]["error"] ;
            
        } else {
            
            $blob = mysql_real_escape_string(file_get_contents($_FILES['my_file']['tmp_name']));
            mysql_query("INSERT INTO `monitoring_screenshots` (`unixtime`, `mac`, `image`) VALUES (UNIX_TIMESTAMP(NOW()), '$_POST[mac]', '$blob');");
            
            echo "Upload Successful!";
            
        }
        
    } else {
        
        die('File not uploaded.');
        
    }
}